;(function() {

	var _global;
	var tool = {
		formatDate: formatDate,
		sibling: sibling,
		hasClass: hasClass,
		removeClass: removeClass,
		addClass: addClass,
		getQueryString: getQueryString
	}

	function formatDate(now) {
	var now = new Date(now);
　　var year = now.getFullYear(),
　　month = now.getMonth() + 1,
　　date = now.getDate(),
　　hour = now.getHours(),
　　minute = now.getMinutes(),
　　second = now.getSeconds();
　　return month + "月" + date + "日";
	}

	function sibling(ele) {
		let r = [];
		let n = ele.parentNode.firstChild;
		for(; n; n = n.nextSibling) {
			if(n.nodeType === 1 && n!== ele) {
				r.push( n );
			}
		}
		return r;
	}

	function hasClass(ele, cls) {
		return ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
	}

	function removeClass(ele, cls) {
		if (hasClass(ele, cls)) {
			var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
			ele.className = ele.className.replace(reg, " ");
		}
	}


	function addClass(ele, cls) {
		if (!this.hasClass(ele, cls)) ele.className += " " + cls;
	}
	function getQueryString(name) { 
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r != null) return decodeURIComponent(r[2]); return null; 
	} 

	_global = (function(){ return this || (0, eval)('this'); }());
    !('tool' in _global) && (_global.tool = tool);
})()

// export {formatDate, sibling, hasClass, removeClass, addClass}
